﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Clandestine.Entities
{
    public class DelegateTrigger : Trigger
    {
        private bool triggered = false;

        public string DelegateName { get; set; }
        public bool TriggerOnce { get; set; }

        public override GLColor EditorColor
        {
            get { return new GLColor(1f, 0f, 0f, 0.5f); }
        }

        public override void Dispose() { }

        public override void OnCollide(int playerXPos, int playerYPos)
        {
            if (TriggerOnce && triggered)
                return;
            else
            {
                WorldMap.Level.Delegates[DelegateName]();
                triggered = true;
            }
        }
    }
}
